package com.hrzyit.whistle.cases.presenter

import com.hrzyit.base.ext.execute
import com.hrzyit.base.presenter.BasePresenter
import com.hrzyit.base.rx.BaseObserver
import com.hrzyit.whistle.cases.data.bean.CaseInfoProcessVo
import com.hrzyit.whistle.cases.presenter.view.CaseTimeLineView
import com.hrzyit.whistle.cases.service.ICaseCenterService
import javax.inject.Inject

/**
 *
 * 案件进度时光轴 Presenter
 * @author YangWei
 * @date 2019/5/14
 */
class CaseTimeLinePresenter @Inject constructor():BasePresenter<CaseTimeLineView>() {


    @Inject
    lateinit var caseCenterService: ICaseCenterService

    /**
     *
     * 获取案件进度情况数据
     * @author YangWei
     * @date 2019/5/9
     * @param caseId 案件id
     * @return MutableList<CaseInfoProcessVo> {@link CaseInfoProcessVo}
     */
    fun getCaseInfoProcessListByCaseId(caseId: Long) {

        if (!checkNetWork()) {
            return
        }

        caseCenterService.getCaseInfoProcessListByCaseId(caseId)
            .execute(object : BaseObserver<MutableList<CaseInfoProcessVo>>(mView) {
                override fun onNext(t: MutableList<CaseInfoProcessVo>) {
                    mView.onGetCaseInfoProcessListByCaseIdSuccess(t)
                }
            }, lifecycleProvider)
    }

}